package com.example.anliku.controller;

import com.example.anliku.entity.System;
import com.example.anliku.entity.Message;
import com.example.anliku.service.SystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "系统配置模块")
@RestController
@RequestMapping("/api/system")
public class SystemController {
    @Resource
    private SystemService systemService;

    @ApiOperation(value = "添加系统配置")
    @PostMapping("/one")
    public Message insert(System system) {
        return systemService.insertSelective(system);
    }

    @ApiOperation(value = "删除系统配置")
    @DeleteMapping("/delete")
    public Message delete(Integer systemId) {
        return systemService.deleteByPrimaryKey(systemId);
    }

    @ApiOperation(value = "修改系统配置")
    @PostMapping("/put")
    public Message update(System system) {
        return systemService.updateByPrimaryKeySelective(system);
    }

    @ApiOperation(value = "获取所有系统配置")
    @GetMapping("/all")
    public Message selectAll(){
        return systemService.selectAll();
    }

    @ApiOperation(value = "根据系统配置id获取系统配置")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer systemId){
        return systemService.selectByPrimaryKey(systemId);
    }
}
